package com.wt.test.sre.provider.controller;

import com.wt.test.sre.provider.service.BookService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author qiyu
 * @since 2025/9/17
 */
@RestController
@RequestMapping("/book")
@Slf4j
@RequiredArgsConstructor
public class BookController {
    
    private final BookService bookService;
    
    @GetMapping("/create")
    public Long createBook(@RequestParam("name") String name) {
        log.info("Start to create book, name:{}", name);
        Long id = bookService.createBook(name);
        log.info("Create book success, name:{}", name);
        return id;
    }
}